
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>6、HELPER · turf源码算法分析</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="lijian">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="chapter7.html" />
    
    
    <link rel="prev" href="chapter5.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    INTRODUCE
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="chapter1.html">
            
                <a href="chapter1.html">
            
                    
                    1、MEASUREMENT
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="chapter2.html">
            
                <a href="chapter2.html">
            
                    
                    2、COORDINATE MUTATION
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="chapter3.html">
            
                <a href="chapter3.html">
            
                    
                    3、TRANSFORMATION
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="chapter4.html">
            
                <a href="chapter4.html">
            
                    
                    4、FEATURE CONVERSION
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="chapter5.html">
            
                <a href="chapter5.html">
            
                    
                    5、MISC
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.7" data-path="chapter6.html">
            
                <a href="chapter6.html">
            
                    
                    6、HELPER
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="chapter7.html">
            
                <a href="chapter7.html">
            
                    
                    7、RANDOM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="chapter8.html">
            
                <a href="chapter8.html">
            
                    
                    8、DATA
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="chapter9.html">
            
                <a href="chapter9.html">
            
                    
                    9、INTERPOLATION
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="chapter10.html">
            
                <a href="chapter10.html">
            
                    
                    10、JOINS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="chapter11.html">
            
                <a href="chapter11.html">
            
                    
                    11、GRIDS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="chapter12.html">
            
                <a href="chapter12.html">
            
                    
                    12、CLASSIFICATION
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="chapter13.html">
            
                <a href="chapter13.html">
            
                    
                    13、AGGREGATION
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="chapter14.html">
            
                <a href="chapter14.html">
            
                    
                    14、META
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="chapter15.md">
            
                <span>
            
                    
                    15、ASSERTIONS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="chapter16.html">
            
                <a href="chapter16.html">
            
                    
                    16、BOOLEANS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="chapter17.md">
            
                <span>
            
                    
                    17、UNIT CONVERSION
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >6、HELPER</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="geojson&#x5BF9;&#x8C61;">GeoJSON&#x5BF9;&#x8C61;</h1>
<ul>
<li>Geometry&#xFF1A;&#x51E0;&#x4F55;&#x5BF9;&#x8C61;&#xFF0C;&#x5B58;&#x50A8;&#x5750;&#x6807;</li>
<li>Feature&#xFF1A;&#x8981;&#x7D20;&#x5BF9;&#x8C61;</li>
<li>FeatureCollection&#xFF1A;&#x8981;&#x7D20;&#x5BF9;&#x8C61;&#x96C6;&#x5408;</li>
</ul>
<p>&#x8FD9;&#x4E09;&#x79CD;&#x5BF9;&#x8C61;&#x6709;&#x5305;&#x542B;&#x5173;&#x7CFB;&#xFF0C;Feature&#x5BF9;&#x8C61;&#x7684;geometry&#x5C5E;&#x6027;&#x662F;Geometry&#x5BF9;&#x8C61;&#xFF1B;FeatureCollection&#x5BF9;&#x8C61;&#x7684;features&#x5C5E;&#x6027;&#x662F;Feature&#x5BF9;&#x8C61;&#x7684;&#x96C6;&#x5408;&#xFF0C;&#x4E0B;&#x9762;&#x770B;&#x8BE6;&#x7EC6;&#x770B;&#x8FD9;&#x4E09;&#x79CD;&#x5BF9;&#x8C61;</p>
<h3 id="1&#x3001;geometry&#x5BF9;&#x8C61;">1&#x3001;Geometry&#x5BF9;&#x8C61;</h3>
<p>geometry&#x5BF9;&#x8C61;&#x5206;&#x4E3A;</p>
<ul>
<li><p>Point</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;Point&quot;</span>,
    <span class="hljs-string">&quot;coordinates&quot;</span>: [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>]
}
</code></pre>
</li>
<li><p>MultiPoint</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;MultiPoint&quot;</span>,
    <span class="hljs-string">&quot;coordinates&quot;</span>: [
        [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>],
        [<span class="hljs-number">101.0</span>, <span class="hljs-number">1.0</span>]
    ]
}
</code></pre>
</li>
</ul>
<ul>
<li><p>LineString</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;LineString&quot;</span>,
    <span class="hljs-string">&quot;coordinates&quot;</span>: [
        [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>],
        [<span class="hljs-number">101.0</span>, <span class="hljs-number">1.0</span>]
    ]
}
</code></pre>
</li>
<li><p>MultiLineString</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;MultiLineString&quot;</span>,
    <span class="hljs-string">&quot;coordinates&quot;</span>: [
        [
            [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>],
            [<span class="hljs-number">101.0</span>, <span class="hljs-number">1.0</span>]
        ],
        [
            [<span class="hljs-number">102.0</span>, <span class="hljs-number">2.0</span>],
            [<span class="hljs-number">103.0</span>, <span class="hljs-number">3.0</span>]
        ]
    ]
}
</code></pre>
</li>
<li><p>Polygon</p>
<p>Polygon&#x7684;coordinates&#x662F;&#x4E00;&#x4E2A;&#x4E09;&#x7EF4;&#x6570;&#x7EC4;&#xFF0C;&#x5B58;&#x50A8;&#x5750;&#x6807;&#x7528;&#x4E8C;&#x7EF4;&#x4E0D;&#x5C31;&#x53EF;&#x4EE5;&#x4E86;&#xFF0C;&#x4E3A;&#x4EC0;&#x4E48;&#x8981;&#x4E09;&#x7EF4;&#x54E9;&#xFF0C;&#x8FD9;&#x662F;&#x8003;&#x8651;&#x5230;&#x6709;&#x9542;&#x7A7A;&#x591A;&#x8FB9;&#x5F62;&#x7684;&#x60C5;&#x51B5;</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;Polygon&quot;</span>,
    <span class="hljs-string">&quot;coordinates&quot;</span>: [
        [
            [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>],
            [<span class="hljs-number">101.0</span>, <span class="hljs-number">0.0</span>],
            [<span class="hljs-number">101.0</span>, <span class="hljs-number">1.0</span>],
            [<span class="hljs-number">100.0</span>, <span class="hljs-number">1.0</span>],
            [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>]
        ]
    ]
}

<span class="hljs-comment">// &#x9542;&#x7A7A;&#x591A;&#x8FB9;&#x5F62;</span>
{
    <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;Polygon&quot;</span>,
    <span class="hljs-string">&quot;coordinates&quot;</span>: [
        [
            [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>],
            [<span class="hljs-number">101.0</span>, <span class="hljs-number">0.0</span>],
            [<span class="hljs-number">101.0</span>, <span class="hljs-number">1.0</span>],
            [<span class="hljs-number">100.0</span>, <span class="hljs-number">1.0</span>],
            [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>]
        ],
        [
            [<span class="hljs-number">100.8</span>, <span class="hljs-number">0.8</span>],
            [<span class="hljs-number">100.8</span>, <span class="hljs-number">0.2</span>],
            [<span class="hljs-number">100.2</span>, <span class="hljs-number">0.2</span>],
            [<span class="hljs-number">100.2</span>, <span class="hljs-number">0.8</span>],
            [<span class="hljs-number">100.8</span>, <span class="hljs-number">0.8</span>]
        ]
    ]
}
</code></pre>
</li>
</ul>
<ul>
<li><p>MultiPolygon</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;MultiPolygon&quot;</span>,
    <span class="hljs-string">&quot;coordinates&quot;</span>: [
        [
            [
                [<span class="hljs-number">102.0</span>, <span class="hljs-number">2.0</span>],
                [<span class="hljs-number">103.0</span>, <span class="hljs-number">2.0</span>],
                [<span class="hljs-number">103.0</span>, <span class="hljs-number">3.0</span>],
                [<span class="hljs-number">102.0</span>, <span class="hljs-number">3.0</span>],
                [<span class="hljs-number">102.0</span>, <span class="hljs-number">2.0</span>]
            ]
        ],
        [
            [
                [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>],
                [<span class="hljs-number">101.0</span>, <span class="hljs-number">0.0</span>],
                [<span class="hljs-number">101.0</span>, <span class="hljs-number">1.0</span>],
                [<span class="hljs-number">100.0</span>, <span class="hljs-number">1.0</span>],
                [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>]
            ],
            [
                [<span class="hljs-number">100.2</span>, <span class="hljs-number">0.2</span>],
                [<span class="hljs-number">100.2</span>, <span class="hljs-number">0.8</span>],
                [<span class="hljs-number">100.8</span>, <span class="hljs-number">0.8</span>],
                [<span class="hljs-number">100.8</span>, <span class="hljs-number">0.2</span>],
                [<span class="hljs-number">100.2</span>, <span class="hljs-number">0.2</span>]
            ]
        ]
    ]
}
</code></pre>
</li>
</ul>
<ul>
<li><p>GeometryCollection</p>
<pre><code class="lang-json">
{
    <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;GeometryCollection&quot;</span>,
    <span class="hljs-string">&quot;geometries&quot;</span>: [{
        <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;Point&quot;</span>,
        <span class="hljs-string">&quot;coordinates&quot;</span>: [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>]
    }, {
        <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;LineString&quot;</span>,
        <span class="hljs-string">&quot;coordinates&quot;</span>: [
            [<span class="hljs-number">101.0</span>, <span class="hljs-number">0.0</span>],
            [<span class="hljs-number">102.0</span>, <span class="hljs-number">1.0</span>]
        ]
    }]
}
</code></pre>
</li>
</ul>
<p>Geometry&#x5BF9;&#x8C61;&#x5982;&#x679C;&#x5B58;&#x5728;&#x4E00;&#x6761;&#x7EBF;&#x8DE8;&#x8D8A;&#x65E5;&#x754C;&#x7EBF;&#xFF0C;&#x5219;&#x5206;&#x5F00;&#x5199;&#xFF0C;&#x5982;&#x4E00;&#x6761;&#x7EBF;&#x4ECE;170&#xB0;E 45&#xB0;N&#x5230;170&#xB0;W 45&#xB0;N&#xFF0C;&#x5219;&#x5199;&#x6210;</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;MultiLineString&quot;</span>,
    <span class="hljs-string">&quot;coordinates&quot;</span>: [
        [
            [<span class="hljs-number">170.0</span>, <span class="hljs-number">45.0</span>], [<span class="hljs-number">180.0</span>, <span class="hljs-number">45.0</span>]
        ], [
            [<span class="hljs-number">-180.0</span>, <span class="hljs-number">45.0</span>], [<span class="hljs-number">-170.0</span>, <span class="hljs-number">45.0</span>]
        ]
    ]
}
</code></pre>
<h3 id="2&#x3001;feature&#x5BF9;&#x8C61;">2&#x3001;Feature&#x5BF9;&#x8C61;</h3>
<p>Feature&#x683C;&#x5F0F;&#x4E3A;</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;Feature&quot;</span>, <span class="hljs-comment">// &#x56FA;&#x5B9A;&#x4E3A;feature</span>
    <span class="hljs-string">&quot;geometry&quot;</span>: {
        <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;Point&quot;</span>,
        <span class="hljs-string">&quot;coordinates&quot;</span>: [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>]
    },
    <span class="hljs-string">&quot;properties&quot;</span>:{
        name: <span class="hljs-string">&apos;balabala&apos;</span>
    }, 
    <span class="hljs-string">&quot;id&quot;</span>: <span class="hljs-number">0</span>  <span class="hljs-comment">// string / number</span>
}
</code></pre>
<h3 id="3&#x3001;featurecollection&#x5BF9;&#x8C61;">3&#x3001;FeatureCollection&#x5BF9;&#x8C61;</h3>
<p>FeatureCollection&#x683C;&#x5F0F;&#x4E3A;</p>
<pre><code class="lang-json">{
    type: <span class="hljs-string">&quot;FeatureCollection&quot;</span>,
    features: [
        {
            <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;Feature&quot;</span>,
            <span class="hljs-string">&quot;geometry&quot;</span>: {
                <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;Point&quot;</span>,
                <span class="hljs-string">&quot;coordinates&quot;</span>: [<span class="hljs-number">100.0</span>, <span class="hljs-number">0.0</span>]
            },
            <span class="hljs-string">&quot;properties&quot;</span>:{
                name: <span class="hljs-string">&apos;balabala&apos;</span>
            }, 
            <span class="hljs-string">&quot;id&quot;</span>: <span class="hljs-number">0</span>
        }
    ]
}
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="chapter5.html" class="navigation navigation-prev " aria-label="Previous page: 5、MISC">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="chapter7.html" class="navigation navigation-next " aria-label="Next page: 7、RANDOM">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"6、HELPER","level":"1.7","depth":1,"next":{"title":"7、RANDOM","level":"1.8","depth":1,"path":"Chapter/chapter7.md","ref":"Chapter/chapter7.md","articles":[]},"previous":{"title":"5、MISC","level":"1.6","depth":1,"path":"Chapter/chapter5.md","ref":"Chapter/chapter5.md","articles":[]},"dir":"ltr"},"config":{"plugins":["sharing","livereload"],"styles":{"website":"./styles/website.css"},"pluginsConfig":{"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["weibo","google","twitter","weibo","instapaper"]},"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"lijian","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"turf源码算法分析","language":"zh-hans","gitbook":"3.2.3","description":"turf源码算法分析"},"file":{"path":"Chapter/chapter6.md","mtime":"2021-01-17T08:46:02.605Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-03-28T04:08:06.675Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

